<template>
	<view class="page">
		<image class="icon" src="../../static/register_success.png" mode=""></image>
		<view class="text">
			恭喜，注册成功！
		</view>
		<view class="reason">
			交纳保证金就可以接单了哦~
		</view>
		<view class="toEdit" @click="toEdit">确认支付</view>
		<view class="back" @click="back">返回</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			toEdit(){
				this.$pay('pay/pay',{
					pay_type:1,
				},(res)=>{
					console.log(res)
					uni.requestPayment({
					    timeStamp: res.timeStamp,
					    nonceStr: res.nonceStr,
					    package: res.package,
					    signType: res.signType,
					    paySign: res.paySign,
					    success: (res) => {
					        uni.showToast({
					            title: "支付成功!"
					        })
							setTimeout(()=>{
								uni.switchTab({
									url:"/pages/my/my"
								})
							},1000)
					    },
					    fail: (res) => {
					        uni.showModal({
					            content: "支付失败",
					            showCancel: false
					        })
					    },
					    complete: () => {
					        this.loading = false;
					    }
					})
				})
			},
			back(){
				uni.navigateBack();
			},
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}

	.page {
		border-top: 20rpx solid #F6F6F6;
		padding: 0 60rpx;
	}

	.icon {
		width: 228rpx;
		height: 228rpx;
		display: block;
		margin: 0 auto;
		margin-top: 140rpx;
	}

	.text {
		margin-top: 20rpx;
		font-size: 34rpx;
		text-align: center;
	}

	.reason {
		color: #666666;
		font-size: 26rpx;
		margin-top: 200rpx;
	}

	.toEdit {
		line-height: 98rpx;
		background: #22BF8A;
		border-radius: 8rpx;
		color: #fff;
		font-size: 34rpx;
		text-align: center;
		margin-top: 38rpx;
	}

	.back {
		margin-top: 30rpx;
		border-radius: 8rpx;
		border: 1px solid #EEEEEE;
		line-height: 98rpx;
		font-size: 34rpx;
		text-align: center;
		color: #999999;
	}
</style>
